<!DOCTYPE html>
<html>

<head>
    <meta name="layout" content="main2" />
    <g:set var="entityName" value="${message(code: 'contract.label', default: 'OpportunityContract')}" />
    <title>
        <g:message code="default.edit.label" args="[entityName]" />
    </title>
</head>

<body>
    <div class="main-body">
        <div class="page-wrapper">
            <!-- Page-header start -->
            <div class="page-header">
                <div class="page-header-title">
                    <h4>编辑合同信息</h4>
                </div>

                <div class="page-header-breadcrumb">
                    <ul class="breadcrumb-title">
                        <li class="breadcrumb-item">
                            <a href="/salesDashboard/index">
                                <i class="icofont icofont-home"></i>
                            </a>
                        </li>
                        <li class="breadcrumb-item">
                            <g:link controller="contract" action="index">合同信息</g:link>
                        </li>
                        <li class="breadcrumb-item">编辑合同信息</li>
                    </ul>
                </div>
            </div>
            <!-- Page-header end -->
            <!-- Page-body start -->
            <div class="page-body">
                <g:if test="${flash.message}">
                    <div class="message alert alert-info" role="status">${flash.message}
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">×</span></button>
                    </div>
                </g:if>
                <g:hasErrors bean="${this.contract}">
                    <ul class="errors" role="alert">
                        <g:eachError bean="${this.contract}" var="error">
                            <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>>
                                <g:message error="${error}" />
                            </li>
                        </g:eachError>
                    </ul>
                </g:hasErrors>
                <!-- Hover table card start -->
                <div class="card">
                    <div class="card-header">
                        <h5>编辑资产信息</h5>

                        <div class="card-header-right">
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>

                    <div class="card-block">
                        <g:form resource="${this.contract}" method="PUT">
                            <div class="form-group row">
                                <label class="col-md-2 control-label">合同编号</label>

                                <div class="col-md-3">
                                    <g:textField name="serialNumber" value="${this.contract?.serialNumber}" class="form-control" />
                                </div>

                                <label class="col-md-2 control-label">标题</label>

                                <div class="col-md-3">
                                    <g:textField name="subject" value="${this.contract?.subject}" class="form-control" />

                                </div>
                            </div>

                            <div class="hr-line-dashed"></div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label IS-required">合同类型</label>

                                <div class="col-md-3">
                                    <g:select name="type.id" id="contractType" value="${this.contract?.type?.id}" from="${com.next.ContractType.list()}" optionKey="id" optionValue="name" class="form-control" />
                                </div>
                                <label class="col-md-2 control-label is-required">状态</label>

                                <div class="col-md-3">
                                    <g:select name="status" id="status" value="${this.contract?.status?.id}" from="${com.next.ContractStatus.list()}" optionKey="id" optionValue="name" class="form-control" />
                                </div>

                            </div>

                            <div class="hr-line-dashed"></div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">客户</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="account" id="account" value="${this.contract?.account?.id}" optionKey="id" from="${com.next.Account.findAllByActive(true)}" noSelection="${['': '请选择']}" />
                                </div>

                                <label class="col-md-2 control-label">销售人员姓名</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="user" id="user" value="${this.contract?.user?.id}" optionValue="fullName" optionKey="id" from="${com.next.User.list()}" noSelection="${['': '请选择']}" />
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-md-2 control-label">金额</label>

                                <div class="col-md-3">

                                  <div class="input-group">
                                      <g:textField name="amount" id="amount" value="${this.contract?.amount}" class="form-control" />
                                      <span class="input-group-addon">元</span>
                                  </div>
                                </div>


                            </div>

                            <div class="hr-line-dashed"></div>

                            <div class="form-group row">
                                <label class="col-md-2 control-label">开始时间</label>

                                <div class="col-md-3 datePicker">
                                    <div class="input-group">
                                        <input type="text" valctrl="startTime" value="${this.contract?.startTime}" class="form-control form_date">
                                        <input type="hidden" id="startTime" name="startTime" value="date.struct">
                                        <input type="hidden" id="startTime_day" name="startTime_day" value="">
                                        <input type="hidden" id="startTime_month" name="startTime_month" value="">
                                        <input type="hidden" id="startTime_year" name="startTime_year" value="">
                                    </div>
                                </div>
                                <label class="col-md-2 control-label">结束时间</label>

                                <div class="col-md-3 datePicker">
                                    <div class="input-group ">
                                        <input type="text" valctrl="endTime" value="${this.contract?.endTime}" class="form-control form_date">
                                        <input type="hidden" id="endTime" name="endTime" value="date.struct">
                                        <input type="hidden" id="endTime_day" name="endTime_day" value="">
                                        <input type="hidden" id="endTime_month" name="endTime_month" value="">
                                        <input type="hidden" id="endTime_year" name="endTime_year" value="">
                                    </div>
                                </div>
                            </div>

                            <div class="hr-line-dashed"></div>

                            <div class="form-group row">
                                <div class="col-md-12">
                                    <g:submitButton class="btn btn-info" name="create" value="保存" />
                                </div>
                            </div>
                        </g:form>
                    </div>

                </div>
            </div>
        </div>
</body>

</html>
